<?php ob_start();
include("config/config.php");
 
 $t = time();

$number = count($_FILES["item_file"]['name']);

$number = $number-1;
	if(count($_FILES["item_file"]['name'])>0) {  
		for($j=0; $j < count($_FILES["item_file"]['name']); $j++) { 
			$filen = $_FILES["item_file"]['name']["$j"];  
			$path = 'uploads/'.$j.$t.$filen; 
			$thumb_folder_path = "uploads/thumb/";
			$image = $j.$t.$filen;
			$thumb_target_path = $thumb_folder_path."t_".$image;
			if(move_uploaded_file($_FILES["item_file"]['tmp_name']["$j"],$path)) ; 	
				$image1 = new SimpleImage();
				$image1->load($path);
				$image1->resize(138,172);
				$image1->save($thumb_target_path);
				$sql=mysql_query("INSERT INTO `my_images` SET   `userid`='1' ,
																`url_id`='".$_SESSION['url_id']."',
																`image`='".$image."',
																`alt_text`='Untitled Document'
																 ")or die(mysql_error());
				$id=mysql_insert_id();
			
		echo "<section class='photo_section'>
<div class='photo_main'><img src='uploads/thumb/t_$image' height='172' width='138'  ></div>
<div class='photo_select'><img src='images/delete_bt.png' onclick=\"deleteimg(this,'".$id."')\" style='float: left;margin-right: 4px;' />
<span><p></p><input type='text' value='Default Name' name='alt_text' title='".$id."' style='width: 109px;margin-top: -5px;'/></span> 
</div>
</section>";
			
			
		 
			if ($j==$number){
					}
		} }


 
 
 ?>